<?
require_once("dbconnect.php");
require_once("admin_functions.php");
require_once("classes/mail.php");
require_once("../articles/classes/article.php");
chk_session();

if($_GET['action'] == "DELETE")
{
	$query_data = "Delete from articles where articles_id=".$_REQUEST['article_id'];
	$result_update	= mysql_query ( $query_data ) or die(mysql_error());
}
$articleObj=new article("");
$articles = $articleObj->list_articles();
?>

<?php require_once('include/header.php'); ?>
      <div id="middle_container_for_innerpage">
      <div id="innerpage_top_image"><img src="images/images/innerpage_top_corner_820x5.jpg"  height="5" /></div> 
      <div id="middle_inner_container">
      <?php require_once('include/left_side_menu.php'); ?>
	          
        <div id="inner_page_middle_data">
        	<div id="page_heading">Manage Articles</div>
            <div id="article_container">
            	<div id="add_new_art"><a href="mod_articles.php">Add New Article</a></div>
                <div id="add_new_art_head">
               		<div id="sr_no">Sr.No.</div>
                    <div id="article_name">Article Name</div>
                    <div id="article_action">Action</div>
                </div>
                <div id="add_new_art"><?php
					for($i=0;$i<count($articles);$i++) {?>
                </div>
                <div id="add_new_art_content" onmouseover="myBG(this,'#F3FFD7')" onmouseout="myBG(this,'')">
                	<div id="sr_no_content"><?=($i+1)?>.</div>
                    <div id="article_name_content"><?=$articles[$i]['article_name']?></div>
                    <div id="article_action_content"><a href="mod_articles.php?article_id=<?=$articles[$i]['articles_id']?>">Modify</a> | <a href="JavaScript:if(confirm('Are you sure you want to Delete this Customer?')){self.location.href='manage_articles.php?article_id=<?=$articles[$i]['articles_id']?>&action=DELETE';}">Delete</a></div>
                </div>
                <div id="add_new_art"><? } ?></div>
            </div>
		</div>
      </div> 
      <div id="corner_container_bottom_for_innerpage"><img src="images/images/innerpage_bottom_corner_820x10.jpg"  height="10" /></div>
    </div> 
      <!-- middle_container ends -->
    
    <div id="bottom_container">
<?php require_once('include/footer.php'); ?>